package com.readpost.mapper;


import com.readpost.doman.Entity.ArticleTags;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleTageMapper {



    //添加文章标签
    @Insert("INSERT INTO article_tags (name, description,usage_count,created_at,updated_at) VALUES (#{tageName}, #{description}, #{usageCount},NOW(),NOW())")
    void addArticleTag();

    //通过文章id查询文章标签
    @Select("SELECT * FROM article_tags WHERE tag_id = #{articleId}")
    List<ArticleTags> getArticleTagsByArticleId(Integer articleId);

    //通过文章id查询文章标签是否存在
    @Select("SELECT * FROM article_tags WHERE tag_id = #{articleId}")
    int getArticleTagsRecordByArticleId(Integer articleId);


    //查询所有文章标签
    @Select("SELECT * FROM article_tags")
    List<ArticleTags> getAllArticleTags();
}

